import org.rsbot.script.methods.Bank;
import org.rsbot.script.methods.Calculations;
import org.rsbot.script.methods.Camera;
import org.rsbot.script.methods.Inventory;
import org.rsbot.script.methods.NPCs;
import org.rsbot.script.methods.Walking;
import org.rsbot.script.wrappers.RSNPC;
import org.rsbot.script.wrappers.RSPath;

public class AionAirCrafter$BankAction extends AionAirCrafter.Action
{
  public AionAirCrafter$BankAction(AionAirCrafter paramAionAirCrafter)
  {
  }

  public String getDesc()
  {
    if (!AionAirCrafter.access$000(this.this$0).isOpen())
      return "Opening bank.";
    if (AionAirCrafter.access$100(this.this$0).contains(556)) {
      return "Depositing items.";
    }
    return "Withdrawing items.";
  }

  public boolean isValid() {
    return (!AionAirCrafter.access$200(this.this$0)) && (AionAirCrafter.access$300(this.this$0));
  }

  public void process() {
    if (AionAirCrafter.access$400(this.this$0).isOpen()) {
      if (AionAirCrafter.access$500(this.this$0).contains(556)) {
        if (AionAirCrafter.access$600(this.this$0).containsOneOf(new int[] { 1438, 1436 }))
          AionAirCrafter.access$700(this.this$0).depositAllExcept(new int[] { 1438, 1436 });
        else
          AionAirCrafter.access$800(this.this$0).depositAll();
      }
      else if (!AionAirCrafter.access$900(this.this$0).contains(1436)) {
        int i = AionAirCrafter.access$1000(this.this$0).getCount(new int[] { 1436 });
        if (i < 1)
          this.this$0.log("You are out of rune essences!");
        else {
          AionAirCrafter.access$1100(this.this$0).withdraw(1436, 0);
        }
      }
      this.this$0.sleep(600, 800);
    } else {
      RSNPC localRSNPC = AionAirCrafter.access$1200(this.this$0).getNearest(AionAirCrafter.Constants.FILTER_NPC);
      if (localRSNPC != null)
        if (localRSNPC.isOnScreen()) {
          localRSNPC.doAction("Bank");
          if (AionAirCrafter.access$1300(this.this$0).distanceTo(localRSNPC) > 1) {
            AionAirCrafter.access$1400(this.this$0, this.this$0.random(600, 900));
            AionAirCrafter.access$1500(this.this$0);
          }
          AionAirCrafter.access$1600(this.this$0, 762, this.this$0.random(600, 800));
        } else {
          AionAirCrafter.access$1700(this.this$0).turnToCharacter(localRSNPC);
          if (!localRSNPC.isOnScreen())
            AionAirCrafter.access$1800(this.this$0).getPath(localRSNPC.getLocation()).traverse();
        }
    }
  }
}